import { combineReducers, createStore, applyMiddleware } from "redux";
import { TypedUseSelectorHook, useSelector } from "react-redux";
import { homeArticleList } from "./reducers/home/homeArticleList";
import { article } from "./reducers/article/article"
import thunk from 'redux-thunk';

export const reducers = combineReducers({ homeArticleList, article });
const store = createStore(reducers, applyMiddleware(thunk));
export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;
export const appSelector: TypedUseSelectorHook<RootState> = useSelector;
export default store;